<?php
session_start();
include '../dbconnect.php';
 ?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TechNova - The Leader of Future Technology</title>
    <link rel="stylesheet" href="../css/styles.css">
</head>
<body>
    <div class="container">
		<!-- header.php -->
        <?php include '../common/header.php'; ?>
		<!-- body -->
        <div class="hero" style="margin-top:100px">+
            <h1>Welcome to TechNova</h1>
            <p>Leading future technology, innovating unlimited possibilities</p>
        </div>
		
		
		<?php
		include '../dbconnect.php';
		
		// 获取当前登录用户的ID
		$uid = $_SESSION['uid'];
		$uname = $_SESSION['uname'];
		
		// 查询用户的预约信息
		$sql = "SELECT 
		            APPOINTMENT_ID, 
		            APPOINTMENT_USER_NAME, 
		            APPOINTMENT_USER_EMAIL, 
		            APPOINTMENT_USER_PHONE, 
		            APPOINTMENT_SERVICE_TYPE, 
		            APPOINTMENT_SERVICE_DESC, 
		            APPOINTMENT_SERVICE_TIME
		        FROM 
		            appointment
		        WHERE 
		            APPOINTMENT_USER_NAME = '".$uname."' AND
		            IS_DELETE = 0";
		
		$result = $conn->query($sql);
		
		// 处理查询结果
		if ($result->num_rows > 0) {
		    while ($row = $result->fetch_assoc()) {
		        $appointment_time = date('Y年m月d日 H:i', strtotime($row['APPOINTMENT_SERVICE_TIME']));
		        echo '<div class="service-item">';
				echo '<div class="service-content">';
		        echo '<h2>您在'.$appointment_time.'跟我们有一个预约。</h2>';
		        echo '<p>服务类型: '.$row['APPOINTMENT_SERVICE_TYPE'].'</p>';
		        echo '<p>服务描述: '.$row['APPOINTMENT_SERVICE_DESC'].'</p>';
		        echo '</div>';
				echo '</div>';
		    }
		} else {
		    echo '<p>您当前没有任何预约。</p>';
		}
		?>
		
		
		<!--
		   <div class="module new-products">
		       <div class="module-header">
		           <h2 class="module-title">new_product</h2>
		       </div>
		   	
		       <div class="module-content">
		           <ul class="product-list">
		               <?php
		                $sql = "SELECT * FROM goods WHERE GOODS_TYPE = 1";
		               $result = $conn->query($sql);
		               if ($result->num_rows > 0) {
		                   while ($row = $result->fetch_assoc()) {
		                       ?>
		                       <li class="product-item">
		                           <div class="product-image">
		                               <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; ?>">
		                                   <img  src="<?php echo $row['GOODS_PICTURE']?>" alt="<?php echo $row['GOODS_NAME']; ?>">
		                               </a>
		                           </div>
		                           <h3 class="product-name">
		                               <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; ?>">
		                                   <?php echo $row["GOODS_NAME"]; ?>
		                               </a>
		                           </h3>
		                           <del>
		                               <p class="product-price-old"><i>old_price¥</i><?php echo $row["GOODS_OLD_PRICE"]; ?></p>
		                           </del>
		                           <p class="product-price-current"><i>price¥</i><?php echo $row["GOODS_PRICE"]; ?></p>
		                       </li>
		                       <?php
		                   }
		               } else {
		                   echo "<li>0 result</li>";
		               }
		               ?>
		           </ul>
		       </div>
		   </div>
		   
		-->
		
		<!-- new_product end -->
        
		<!-- recommendation 
		<div class="module new-products">
		    <div class="module-header">
		        <h2 class="module-title">recommendation</h2>
		    </div>
		    <div class="module-content">
		        <ul class="product-list">
		            <?php
		             $sql = "SELECT * FROM goods WHERE GOODS_TYPE = 2"; 
		            $result = $conn->query($sql);
		            if ($result->num_rows > 0) {
		                while ($row = $result->fetch_assoc()) {
		                    ?>
		                    <li class="product-item">
		                        <div class="product-image">
		                            <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; ?>">
		                                <img  src="<?php echo $row['GOODS_PICTURE']?>" alt="<?php echo $row['GOODS_NAME']; ?>">
		                            </a>
		                        </div>
		                        <h3 class="product-name">
		                            <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; ?>">
		                                <?php echo $row["GOODS_NAME"]; ?>
		                            </a>
		                        </h3>
		                        <del>
		                            <p class="product-price-old"><i>old_price¥</i><?php echo $row["GOODS_OLD_PRICE"]; ?></p>
		                        </del>
		                        <p class="product-price-current"><i>price¥</i><?php echo $row["GOODS_PRICE"]; ?></p>
		                    </li>
		                    <?php
		                }
		            } else {
		                echo "<li>0 result</li>";
		            }
		            ?>
		        </ul>
		    </div>
		</div>
		recommendation -->
		
		
		<!-- hot 
		<div class="module new-products">
		    <div class="module-header">
		        <h2 class="module-title">hot</h2>
		    </div>
		    <div class="module-content">
		        <ul class="product-list">
		            <?php
		             $sql = "SELECT * FROM goods WHERE GOODS_TYPE = 3"; 
		            $result = $conn->query($sql);
		            if ($result->num_rows > 0) {
		                while ($row = $result->fetch_assoc()) {
		                    ?>
		                    <li class="product-item">
		                        <div class="product-image">
		                            <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; if ($flag == 1) { echo '&uid=' . $uid; } ?>">
		                                <img  src="<?php echo $row['GOODS_PICTURE']?>" alt="<?php echo $row['GOODS_NAME']; ?>">
		                            </a>
		                        </div>
		                        <h3 class="product-name">
		                            <a href="../user/goods.php?id=<?php echo $row["GOODS_ID"]; if ($flag == 1) { echo '&uid=' . $uid; } ?>">
		                                <?php echo $row["GOODS_NAME"]; ?>
		                            </a>
		                        </h3>
		                        <del>
		                            <p class="product-price-old"><i>old_price¥</i><?php echo $row["GOODS_OLD_PRICE"]; ?></p>
		                        </del>
		                        <p class="product-price-current"><i>price¥</i><?php echo $row["GOODS_PRICE"]; ?></p>
		                    </li>
		                    <?php
		                }
		            } else {
		                echo "<li>0 result</li>";
		            }
		            ?>
		        </ul>
		    </div>
		</div>
		hot -->
		
		
        <div class="features">
            <div class="feature">
                <h2>Cutting-edge Technology</h2>
                <p>We provide the most advanced technology solutions</p>
            </div>
            <div class="feature">
                <h2>Professional Team</h2>
                <p>Experienced experts at your service</p>
            </div>
            <div class="feature">
                <h2>Customized Service</h2>
                <p>Tailored to your needs</p>
            </div>
        </div>
        
        <div class="cta">
            <h2>Are you ready to embark on the future?</h2>
            <a href="6_appointment.php" class="button">Make an Appointment Now</a>
        </div>
	
    </div>
    
	
	<!-- footer.php -->
	<?php include '../common/footer.php'; ?>
</body>
</html>
